package com.mywork.mvpkodeinxml.model.request

import org.simpleframework.xml.*

/**
 * Created by mywork on 17/3/17.
 */
@Root(name = "soapenv:Envelope")
@NamespaceList(
    Namespace(reference = "http://www.w3.org/2001/XMLSchema-instance", prefix = "xsi"),
    Namespace(reference = "http://www.w3.org/2001/XMLSchema", prefix = "xsd"),
    Namespace(reference = "http://schemas.xmlsoap.org/soap/encoding/", prefix = "enc"),
    Namespace(reference = "http://schemas.xmlsoap.org/soap/envelope/", prefix = "soapenv")
)
class CommonFunc(val funcAttr: String) {
    @get:Element(name = "soapenv:Body", required = false)
    @set:Element(name = "soapenv:Body", required = false)
    var requestBody = RequestBody(funcAttr)

    @Root(name = "soapenv:Body", strict = false)
    class RequestBody(val funcAttr: String) {
        @get:Element(name = "CommonFunc", required = false)
        @set:Element(name = "CommonFunc", required = false)
        var CommonFunc = RequestModel(funcAttr)
    }

    @Root(name = "CommonFunc", strict = false)
    class RequestModel(val funcAttr: String) {
        @get:Attribute(name = "xmlns")
        @set:Attribute(name = "xmlns")
        var xmls: String = "http://tempuri.org/"

        @get:Element(name = "func", required = false)
        @set:Element(name = "func", required = false)
        var func: String = funcAttr

        @get:Element(name = "strParam", required = false)
        @set:Element(name = "strParam", required = false)
        var strParam: String = "<xml />"

        @get:Element(name = "reserved", required = false)
        @set:Element(name = "reserved", required = false)
        var reserved: String = ""

    }
}
